#pragma once
#include<iostream>
#include<string>
#include<vector>

class Util
{
public:
    static void StringSplit(std::string& in,std::vector<std::string>& out,const std::string& sep)
    {
        while(true)
        {
            auto pos = in.find(sep);
            if(pos == std::string::npos)
                break;
            std::string sub = in.substr(0,pos);
            out.push_back(sub);
            in.erase(0,pos+sep.size());
        }
    }
    static bool ParsePackage(std::string& package,int& x,int& y,char& op)
    {
        char ops[] = {'+','-','*','/'};
        for(int i = 0; i < sizeof(ops)/sizeof(char); ++i)
        {
            auto pos = package.find(ops[i]);
            if(pos == std::string::npos)
                continue;
            x = atoi(package.substr(0,pos).c_str());
            y = atoi(package.substr(pos+1).c_str());
            op = ops[i];
            return true;
        }
        return false;
    }
};